Less (style sheet language)
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
top
Less (Leaner Style Sheets; sometimes stylized as LESS) is a dynamic preprocessor style sheet language that can be compiled into Cascading Style Sheets (CSS) and run on the client side or server side.cite-ref-main-2-0[2] Designed by Alexis Sellier, Less is influenced by Sass and has influenced the newer "SCSS" syntax of Sass, which adapted its CSS-like block formatting syntax.cite-ref-compare-3-0[3] Less is an open source project. Its first version was written in Ruby; however, in the later versions, use of Ruby has been deprecated and replaced by JavaScript. The indented syntax of Less is a nested metalanguage, as valid CSS is valid Less code with the same semantics. Less provides the following mechanisms: variables, nesting, mixins, operators and functions; the main difference between Less and other CSS precompilers is that Less allows real-time compilation via less.js by the browser.cite-ref-main-2-1[2]cite-ref-no-sass-js-4-0[4]
Contents
β’ Features
β’ Variables
β’ Mixins
β’ Comparison
β’ Sass
β’ Use on sites
β’ Less software
β’ See also
β’ References
β’ External links
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Features
Variables
Less allows variables to be defined. Variables in Less are defined with an at sign (@). Variable assignment is done with a colon (:).
During translation, the values of the variables are inserted into the output CSS document.cite-ref-main-2-2[2]
@pale-green-color: #4D926F;
#header {
color: @pale-green-color;
}
h2 {
color: @pale-green-color;
}
The code above in Less would compile to the following CSS code.
#header {
color: #4D926F;
}
h2 {
color: #4D926F;
}
Mixins
Mixins allows embedding all the properties of a class into another class by including the class name as one of its property, thus behaving as a sort of constant or variable. They can also behave like functions, and take arguments. CSS does not support Mixins: Any repeated code must be repeated in each location. Mixins allows for more efficient and clean code repetitions, as well as easier alteration of code.cite-ref-main-2-3[2]
.rounded-corners (@radius: 5px 10px 8px 2px) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
}
#header {
.rounded-corners;
}
#footer {
.rounded-corners(10px 25px 35px 0px);
}
The above code in Less would compile to the following CSS code:
#header {
-webkit-border-radius: 5px 10px 8px 2px;
-moz-border-radius: 5px 10px 8px 2px;
border-radius: 5px 10px 8px 2px;
}
#footer {
-webkit-border-radius: 10px 25px 35px 0px;
-moz-border-radius: 10px 25px 35px 0px;
border-radius: 10px 25px 35px 0px;
}
Less has a special type of ruleset called parametric mixins which can be mixed in like classes, but accepts parameters.
#header {
h1 {
font-size: 26px;
font-weight: bold;
}
p {
font-size: 16px;
a {
text-decoration: none;
color: red;
&:hover {
border-width: 1px;
color: #fff;
}
}
}
}
The above code in Less would compile to the following CSS code:
#header h1 {
font-size: 26px;
font-weight: bold;
}
#header p {
font-size: 16px;
}
#header p a {
text-decoration: none;
color: red;
}
#header p a:hover {
border-width: 1px;
color: #fff;
}
Functions and operations
Less allows operations and functions. Operations allow addition, subtraction, division and multiplication of property values and colors, which can be used to create complex relationships between properties. Functions map one-to-one with JavaScript code, allowing manipulation of values.
@the-border: 1px;
@base-color: #111;
@red: #842210;
#header {
color: @base-color * 3;
border-left: @the-border;
border-right: @the-border * 3;
}
#footer {
color: @base-color + #003300;
border-color: desaturate(@red, 10%);
}
The above code in Less would compile to the following CSS code:
#header {
color: #333;
border-left: 1px;
border-right: 3px;
}
#footer {
color: #114411;
border-color: #7d2717;
}
Comparison
Sass
Less is inspired by Sass.cite-ref-about-6-0[6]cite-ref-compare-3-1[3] Sass was designed to both simplify and extend CSS, so things like curly braces were removed from the syntax. Less was designed to be as close to CSS as possible, and as a result existing CSS can be used as valid Less code.cite-ref-7[7]
The newer versions of Sass also introduced a CSS-like syntax called SCSS (Sassy CSS).
Use on sites
Less can be applied to sites in a number of ways. One option is to include the less.js JavaScript file to convert the code on-the-fly. The browser then renders the output CSS. Another option is to render the Less code into pure CSS and upload the CSS to a site. With this option no .less files are uploaded and the site does not need the less.js JavaScript converter.
Less software
| Name | Description |
|---|---|
| WinLess - Windows GUI for less.js | GUI Less Compiler |
| Crunch | Less editor and compiler (requires Adob⦠|
| less.js-windows | Simple command-line utility for Windows⦠|
| less.app | Less Compiler |
| CodeKit | Less Compiler |
| LessEngine | Less Compiler |
| SimpLESS | Less Compiler |
| Chirpy | Less Compiler |
| Mindscape Web Workbench | Syntax highlighting and IntelliSense fo⦠|
| Eclipse Plugin for Less | Eclipse Plugin |
| mod_less | Apache2 module to compile Less on the f⦠|
| grunt-contrib-less | Node.js Grunt task to convert Less to C⦠|
| Web Essentials | Visual Studio extension with support fo⦠|
| clessc | Pure C++ compiler |
| Less WebCompiler | Web-based compiler |
| Name | Software License |
|---|---|
| WinLess - Windows GUI for less.js | Apache 2.0 |
| Crunch | GPL |
| less.js-windows | MIT License |
| less.app | Proprietary |
| CodeKit | Proprietary |
| LessEngine | Free |
| SimpLESS | free but no explicit license |
| Chirpy | Ms-PL |
| Mindscape Web Workbench | Proprietary |
| Eclipse Plugin for Less | EPL 1.0 |
| mod_less | Open Source |
| grunt-contrib-less | MIT |
| Web Essentials | Apache 2.0 |
| clessc | MIT |
| Less WebCompiler | MIT |
| Name | Platform |
|---|---|
| WinLess - Windows GUI for less.js | Windows |
| Crunch | Windows, Mac OS X |
| less.js-windows | Windows |
| less.app | Mac OS X |
| CodeKit | Mac OS X |
| LessEngine | OpenCart Plugin |
| SimpLESS | Windows Mac OS X Linux |
| Chirpy | Visual Studio Plugin |
| Mindscape Web Workbench | Visual Studio Plugin |
| Eclipse Plugin for Less | Eclipse Plugin |
| mod_less | Linux |
| grunt-contrib-less | Node.js |
| Web Essentials | Windows |
| clessc | at least Windows, Linux, MacOS |
| Less WebCompiler | at least Windows, Linux, MacOS |
| Name | Functionality |
|---|---|
| WinLess - Windows GUI for less.js | Compiler |
| Crunch | Compiler Editor |
| less.js-windows | Compiler |
| less.app | Compiler |
| CodeKit | Compiler |
| LessEngine | Compiler |
| SimpLESS | Compiler |
| Chirpy | Compiler |
| Mindscape Web Workbench | Compiler Syntax Highlighting |
| Eclipse Plugin for Less | Syntax highlighting Content assist Comp⦠|
| mod_less | Compiler |
| grunt-contrib-less | Compiler |
| Web Essentials | Syntax highlighting, Content assist, Co⦠|
| clessc | Compiler |
| Less WebCompiler | Compiler, Syntax highlighting, Minifier |
See also
References
cite-note-wikidata-838c876fae3f0a70b0c719bf0bdee50c5725ab3c-v20-11. "Release 4.4.0". 16 July 2025. Retrieved 22 July 2025.
cite-note-main-22. β citerefthe-core-less-teamThe Core Less Team. "Getting started | Less.js". Less.js. Retrieved 2021-03-19.
cite-note-compare-33. β citerefweizenbaum2009Weizenbaum, Nathan (2009-06-17). "Sass and Less : Nex3". Archived from the original on 2009-06-21. Retrieved 2021-03-19.
cite-note-no-sass-js-44. β citerefmeng2010Meng, Jiew (2010-12-14). Mortensen, Peter (ed.). "css - Is there a SASS.js? Something like LESS.js?". Stack Overflow. Retrieved 2021-03-19.
cite-note-whats-wrong-with-css-55. β citerefatwood2010Atwood, Jeff (2010-04-30). "What's Wrong With CSS". Coding Horror. Retrieved 2022-12-03.
cite-note-about-66. β citerefthe-core-less-teamThe Core Less Team. "About | Less.js". Less.js. Retrieved 2021-03-19.
cite-note-77. β citerefeppstein2010Eppstein, Chris (2010-11-10). "sass_and_less_compared.markdown". GitHub Gist. Retrieved 2021-03-19.
cite-note-82. citereflagendijk2013Lagendijk, Mark (2013-01-29). "License Information Β· Issue #55 Β· marklagendijk/WinLess". GitHub. Retrieved 2021-03-19.
cite-note-93. citerefdean2011Dean, Matthew (2011-12-02). "Crunch/LICENSE.txt at master Β· matthew-dean/Crunch". GitHub. Retrieved 2021-03-19.
cite-note-104. citerefsmart2013Smart, Duncan (2013-07-25). "less.js-windows/LICENSE at master Β· duncansmart/less.js-windows". GitHub. Retrieved 2021-03-19.
cite-note-115. citerefengel2012Engel, Christian (2012-07-29). "SimpLESS/LICENSE.txt at master Β· Paratron/SimpLESS". GitHub. Retrieved 2021-03-19.
cite-note-126. citerefevan-nagleEvan Nagle. "Chirpy - VS Add In For Handling Js, Css, DotLess, and T4 Files - CodePlex Archive". CodePlex. Archived from the original on 2021-02-20. Retrieved 2021-03-19.
cite-note-137. citerefvincent-simonetVincent Simonet. "Eclipse plugin for LESS". normalesup.org. Retrieved 2021-03-19.
cite-note-148. citerefkellen2012Kellen, Tyler (2012-09-04). "grunt-contrib-less/LICENSE-MIT at master Β· gruntjs/grunt-contrib-less". GitHub. Retrieved 2021-03-19.
cite-note-159. citerefkristensen2014Kristensen, Mads (2014-06-18). "WebEssentials2013/LICENSE.txt at master Β· madskristensen/WebEssentials2013". GitHub. Retrieved 2021-03-19.
cite-note-1610. citerefbram-van-der-kroef2017Bram van der Kroef (2017-07-11). "clessc/LICENSE at master Β· BramvdKroef/clessc". GitHub. Retrieved 2021-03-19.
cite-note-1711. citerefsambrishes2018SamBrishes (2018-12-15). "snout.less/LICENSE.md at master Β· pytesNET/snout.less". GitHub. Retrieved 2021-03-19.
External links